package com.jht.mymvvm.activity.homepage

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.jht.mymvvm.db.entity.User

class UserInfoViewModel:ViewModel() {

    val name = MutableLiveData<String>()

    init {
        name.value = "chen"
    }

    val user = Transformations.switchMap(name) {
        DB.findAllUsers(it)
    }


    fun setName(name:String){
        this.name.value = name
    }

}